<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        html,body{
            width: 100%;
            height: 100%;
        }
        div{
            width: 100%;
            height: 100%;
            background: url(asset/images/timg2.jpg) no-repeat center;
            background-size: 1366px 768px;
        }
    </style>
</head>
<body>
<div>

</div>

</body>
</html>
<script src = "node_modules/jquery/dist/jquery.min.js"></script>
<script>

    $(function(){
        var width =  null;
        var height = null;
        window.onresize = function() {
            console.log(1);
            width = $('div').width();
            height = $('div').height();

            $('div').css({
                'backgroundSize': 'height width'
            })
            console.log(width, height);
            console.log($('div').css('background-size'));
        }
    })
</script>